<template>
  <div class="content">
    <div class="checkbutton">
      <img
        src="~assets/img/little-icon/check.png"
        alt=""
        @click="check"
        :class="{ check: ischecked}"
      />
    </div>
    <div class="image">
      <img :src="cartList.image" alt="" />
    </div>
    <div class="right">
      <p class="title">{{ cartList.title }}</p>
      <p class="desc">{{ cartList.desc }}</p>
      <div class="rightbottom">
        <span class="price">￥{{ cartList.price }}</span>
        <span>x{{ cartList.count }}</span>
      </div>
    </div>
    <!-- {{cartList}} -->
  </div>
</template>

<script>
export default {
  props: {
    cartList: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  computed: {
    ischecked() {
      return this.cartList.checked;
    },
  },
  methods: {
    check() {
      this.cartList.checked = !this.cartList.checked;
      // console.log('chceck');
      
      // this.$store.state.cartList.checked = !this.$store.state.cartList.checked;
    },
  },
};
</script>
<style scoped>
.content {
  display: flex;
  margin-bottom: 10px;
  padding: 10px;
  /* margin-top: 44px; */
}
.image {
  flex: 20%;
  margin-right: 10px;
}
.image img {
  border-radius: 5px;
}
.right {
  flex: 80%;
  margin-right: 10px;
}
.right p {
  width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title {
  font-size: 20px;
  margin-bottom: 20px;
}
.desc {
  font-size: 14px;
  color: gray;
  margin-bottom: 30px;
}
.rightbottom {
  display: flex;
  justify-content: space-between;
}
.price {
  color: rgb(221, 63, 63);
  font-size: 20px;
}
.checkbutton {
  display: flex;
  align-items: center;
  margin-right: 10px;
}
.checkbutton img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid gray;
}
.check {
  background-color: rgb(228, 66, 66);
}
</style>
